import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;

import java.security.*;
import java.security.spec.ECGenParameterSpec;

public class tEST7 {

    public static void main(String[] args) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, DecoderException {
        ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256r1");
        SecureRandom random= new SecureRandom(Hex.decodeHex("9c8ac2cd2f8215cfe52fad5793654d6e6777a5df2338dce64dea6fc6cdcb7428"+"972c84e82df3d560a90be7b4fe928fb42dd287e20aa0b74c12b76fba67410c52"));

        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC");
        keyPairGenerator.initialize(ecSpec, random);
        KeyPair keyPair = keyPairGenerator.generateKeyPair();
        System.out.println(Hex.encodeHexString(keyPair.getPublic().getEncoded()));

        System.out.println(keyPair.getPublic().getEncoded().length);


        /**
         * 3059301306072a8648ce3d020106082a8648ce3d03010703420004c07dbefadf131e770603ae3d4b24633487560a94dee0fb486ae4617e8b8445123eff1ba96f3787fcc0ab33e13e1c6798feaf8e7125f1eb70cf73f48c4ddf35ef
         * 3059301306072a8648ce3d020106082a8648ce3d03010703420004a04a73bfff53c8886e046e5a2fb0a084c220e984f1a5d360af8bf868cb2c421878980c5d5790c17bca7b230c683e5c68e677e6b2a49f84d61fc6e1a98e4fcd05
         * 3059301306072a8648ce3d020106082a8648ce3d0301070342000477308e5ce82713f362a0e9bc39c477cc6cb4b6256fba5104285283dd1ac0d50d46e93e98b7951a8097f0bdaf2553761c828b14c98e07159ece47066c6d21019f
         */
        ;
    }
}
